#ifndef _LOGGER_H__
#define _LOGGER_H__


class CLog
{
public:
	CLog(){}
	virtual ~CLog(){}
	virtual int Log(const char* fmt, ...) = 0;
	virtual int LogWarning(const char* fmt, ...) = 0;
	virtual int LogError(const char* fmt, ...) = 0;
protected:
	int Format(char* buffer, int size, const char* fmt, ...);
};


class CScriptLog : public CLog
{
public:
	CScriptLog() {m_edtLog = NULL;}
	~CScriptLog(){}
	static CScriptLog& Instance();
	void InitLogger(CEdit* edit);
	virtual int Log(const char* fmt, ...);
	virtual int LogWarning(const char* fmt, ...);
	virtual int LogError(const char* fmt, ...);
protected:
	void AppendLog(const char* str);
private:
	CEdit*		m_edtLog;
};


#define _LogInfo CScriptLog::Instance().Log
#define _LogWarning CScriptLog::Instance().LogWarning
#define _LogError CScriptLog::Instance().LogError

#endif